package com.wzp.algorithm.must;

/**
 * 希尔排序
 *
 * @author wangzhengpeng
 */
public class ShellSort {

    public static void shellSort(int[] array) {
        int section = array.length / 2;
        while (section >= 1) {
            for (int i = section; i < array.length; i++) {
                int temp = array[i];
                int j = i - section;
                while (j >= 0 && array[j] > temp) {
                    array[j + section] = array[j];
                    j = j - section;
                }
                array[j + section] = temp;
            }
            section /= 2;
        }
    }
}
